package com.asset.dispoal.defaultRoleDepartment;

import com.asset.dispoal.defaultRoleDepartment.api.IGbDefaultRoleDepartmentService;
import com.asset.dispoal.defaultRoleDepartment.dto.GbDefaultRoleDepartmentRequest;
import com.asset.dispoal.defaultRoleDepartment.dto.GbDefaultRoleDepartmentResponse;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import tech.mhuang.pacebox.springboot.core.controller.BaseController;
import tech.mhuang.pacebox.springboot.core.permission.annotation.Permission;
import tech.mhuang.pacebox.springboot.protocol.Result;

/**
 * 默认用户权限控制层
 *
 * @author: mhuang
 * @date: 2022-03-21 13:21:14
 */
@RestController
@RequestMapping("gb/defaultRoleDepartment")
@Api(value = "默认用户权限配置", tags = "默认用户权限配置")
public class GbDefaultRoleDepartmentController extends BaseController {

    @Autowired
    private IGbDefaultRoleDepartmentService gbDefaultRoleDepartmentService;

    @Permission(code = "debtbank:user")
    @GetMapping(value = "/queryByCompanyType")
    @ApiOperation(value = "查询", notes = "查询")
    public Result<GbDefaultRoleDepartmentResponse> queryByCompanyType(String type) {
        return gbDefaultRoleDepartmentService.queryByCompanyType(type);
    }

    @PostMapping(value = "/insert")
    @ApiOperation(value = "添加", notes = "添加")
    public Result insert(@RequestBody GbDefaultRoleDepartmentRequest request) {
        return gbDefaultRoleDepartmentService.insert(request);
    }

    @PutMapping(value = "/update")
    @ApiOperation(value = "修改", notes = "修改")
    public Result update(@RequestBody GbDefaultRoleDepartmentRequest request) {
        return gbDefaultRoleDepartmentService.update(request);
    }

    @PostMapping(value = "/delete")
    @ApiOperation(value = "删除", notes = "删除")
    public Result delete(@RequestBody String type) {
        return gbDefaultRoleDepartmentService.delete(type);
    }

}